using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ChargeRayGunPlayer:Weapon {

	public ChargeRayGunPlayer(WeaponData stat) : base(stat) { }

	public override BurstStats StartBurst() {
		BurstStats result = base.StartBurst();
		currentBurst.shots.AddLast("weapon1");
		return result;
	}

	protected override void PreProcess(ShotStats shot) {
		switch(shot.shotTag) {
		case "weapon0":
			PreProcess1(shot);
			break;
		case "weapon1":
			PreProcess2(shot);
			break;
		}
	}

	void PreProcess1(ShotStats shot) {
		shot.cooldownTime.baseValue=0.2f;
		damageMultiplier=0.3f;
		timeMultiplier=2;
		sizeMultiplier=0.2f;
		shot.ammoConsumption.baseValue=0;
		attackIndex=0;
	}
	void PreProcess2(ShotStats shot) {
		shot.cooldownTime.baseValue=0.7f;
		damageMultiplier=3f;
		timeMultiplier=1;
		sizeMultiplier=1;
		attackIndex=1;
	}

	float damageMultiplier;
	float timeMultiplier;
	float sizeMultiplier;
	protected override void ProjectileFiredEventHandler(object _sender,ProjectileEventArgs e) {
		base.ProjectileFiringEventHandler(_sender,e);
		if(!IfReactFireEvent(_sender,e)) return;
		Projectile sender = _sender as Projectile;

		sender.stat.damage.AddMultiply(damageMultiplier,-100);
		sender.stat.timeTotal.AddMultiply(timeMultiplier,-100);
		sender.stat.size.AddMultiply(sizeMultiplier,-100);

	}

	int attackIndex;
	protected override void DoRecoil(ShotStats stat) {
		base.DoRecoil(stat);
		slot.SetAttackIndex(attackIndex);
	}

}